package com.smartstate.EnvironmentMonitor.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.smartstate.EnvironmentMonitor.entity.EquipMent;
import com.smartstate.EnvironmentMonitor.entity.EquipmentConfiguration;
import com.smartstate.EnvironmentMonitor.vo.ReportVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;


import java.util.List;

@Mapper
public interface DataMapper extends BaseMapper<EquipMent>{

//    DataVO getDataVO(@Param("deviceId") String deviceId);
    List<String> queryDeviceIdByName(@Param("name") String name);

    /**
     * 根据objId查询所有其对应的id
     * @param id
     * @return
     */
    List<ReportVO> queryDeviceIdByObjid(@Param("id") String id);

    /**
     * 获取objId对应名称
     * @param id
     * @return
     */
    @Select("select name from objmoudel where id = #{objId}")
    String queryObjIdName(@Param("objId") String id);

    /**
     * 获取deviceId对应的设备名称
     * @param id
     * @return
     */
    String queryDeviceName(@Param("id") String id);

    /**
     * 查询objId对应设备Id是否存在
     */
    @Select("select deviceId from objmiddle where objId = #{id}")
    List<String> check(@Param("id") String id);

    /**
     * 根据deviceId查询对应主键
     * @param deviceId
     * @return
     */
    @Select("select id from equipment where deviceId = #{deviceId}")
    String queryIdByDeviceId(@Param("deviceId") String deviceId);

    /**
     * 设备对应的objId并且type = 1
     * @param name
     * @return
     */
    String queryObjIdByDeviceId(String name);

    /**
     * 获取补偿值对象
     * @param deviceId
     * @return
     */
    EquipmentConfiguration queryCompensationValue(@Param("deviceId") String deviceId);
}
